bitkeeper revision 1.1159.1.158 (41499106LOJstE56FhydVjOBF9ioOQ)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 16 Sep 2004 13:11:34 +0000 (13:11 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 16 Sep 2004 13:11:34 +0000 (13:11 +0000)
Improve configuration of virtual device drivers in XenLinux.

linux-2.6.8.1-xen-sparse/arch/xen/Kconfig
linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig
linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig
linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c
linux-2.6.8.1-xen-sparse/drivers/xen/Makefile
linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c
linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h

index 2bbe0229b46c8b1ca16b2bbb8b5fbbe12b154bf5..a7e3994e1033fdb6155cd070179463c995b0c5a8 100644 (file)
@@ -31,9 +31,68 @@ config XEN_PRIVILEGED_GUEST
          Support for privileged operation (domain 0)
 
 config XEN_PHYSDEV_ACCESS
-       bool "Device-driver domain (physical device access)"
+       bool "Physical device access"
+       default y if XEN_PRIVILEGED_GUEST
+       default n if !XEN_PRIVILEGED_GUEST
        help
-         Device-driver domain (physical device access)
+         Assume access is available to physical hardware devices
+          (e.g., hard drives, network cards). This allows you to configure
+          such devices and also includes some low-level support that is
+          otherwise not compiled into the kernel.
+
+config XEN_BLKDEV_BACKEND
+        bool "Block-device backend driver"
+        default y if XEN_PHYSDEV_ACCESS
+        default n if !XEN_PHYSDEV_ACCESS
+        help
+          The block-device backend driver allows the kernel to export its
+          block devices to other guests via a high-performance shared-memory
+          interface.
+
+config XEN_NETDEV_BACKEND
+        bool "Network-device backend driver"
+        default y if XEN_PHYSDEV_ACCESS
+        default n if !XEN_PHYSDEV_ACCESS
+        help
+          The network-device backend driver allows the kernel to export its
+          network devices to other guests via a high-performance shared-memory
+          interface.
+
+config XEN_BLKDEV_FRONTEND
+        bool "Block-device frontend driver"
+        default y
+        help
+          The block-device frontend driver allows the kernel to access block
+          devices mounted within another guest OS. Unless you are building a
+          dedicated device-driver domain, or your master control domain
+          (domain 0), then you almost certainly want to say Y here.
+
+config XEN_NETDEV_FRONTEND
+        bool "Network-device frontend driver"
+        default y
+        help
+          The network-device frontend driver allows the kernel to access
+          network interfaces within another guest OS. Unless you are building a
+          dedicated device-driver domain, or your master control domain
+          (domain 0), then you almost certainly want to say Y here.
+
+if XEN_NETDEV_FRONTEND
+config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
+        bool "Pipelined transmitter (DANGEROUS)"
+        default n
+        help
+          The driver will assume that the backend is pipelining packets for
+          transmission: whenever packets are pending in the remote backend,
+          the driver will not send asynchronous notifications when it queues
+          additional packets for transmission.
+          If the backend is a dumb domain, such as a transparent Ethernet
+          bridge with no local IP interface, it is safe to say Y here to get
+          slightly lower network overhead.
+          If the backend has a local IP interface; or may be doing smart things
+          like reassembling packets to perform firewall filtering; or if you
+          are unsure; or if you experience network hangs when this option is
+          enabled; then you must say N here.
+endif
 
 config XEN_WRITABLE_PAGETABLES
        bool "Use writable pagetables"
@@ -49,8 +108,8 @@ config FOREIGN_PAGES
 
 config PAGESIZED_SKBS
        bool
-       default y if XEN_PHYSDEV_ACCESS
-       default n if !XEN_PHYSDEV_ACCESS
+       default y if XEN_NETDEV_BACKEND
+       default n if !XEN_NETDEV_BACKEND
 
 #config VT
 #      bool
index 75fac7e487e2aa0efa7b9429771b482099cb6381..a118d649ccbe91c4ce9d6c30939ba5e43fc759e0 100644 (file)
@@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y
 #
 CONFIG_XEN_PRIVILEGED_GUEST=y
 CONFIG_XEN_PHYSDEV_ACCESS=y
+CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_NETDEV_BACKEND=y
+CONFIG_XEN_BLKDEV_FRONTEND=y
+CONFIG_XEN_NETDEV_FRONTEND=y
+# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_WRITABLE_PAGETABLES=y
 CONFIG_FOREIGN_PAGES=y
 CONFIG_PAGESIZED_SKBS=y
index 8d0d9fc5a308e906859de1a12a9d4e474095b1d9..a3efc64d583aef073a037175d5e77badfd29637f 100644 (file)
@@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y
 #
 # CONFIG_XEN_PRIVILEGED_GUEST is not set
 # CONFIG_XEN_PHYSDEV_ACCESS is not set
+# CONFIG_XEN_BLKDEV_BACKEND is not set
+# CONFIG_XEN_NETDEV_BACKEND is not set
+CONFIG_XEN_BLKDEV_FRONTEND=y
+CONFIG_XEN_NETDEV_FRONTEND=y
+# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_WRITABLE_PAGETABLES=y
 CONFIG_FOREIGN_PAGES=y
 # CONFIG_PAGESIZED_SKBS is not set
index 1efdacd8c228134203763f18c9a5d670fbeecb04..8a12a5c93c25df3649639ab5d2fbe847c3c55529 100644 (file)
@@ -337,8 +337,6 @@ void __init bt_iounmap(void *addr, unsigned long size)
 
 #endif /* CONFIG_XEN_PHYSDEV_ACCESS */
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
-
 /* These hacky macros avoid phys->machine translations. */
 #define __direct_pte(x) ((pte_t) { (x) } )
 #define __direct_mk_pte(page_nr,pgprot) \
@@ -481,6 +479,3 @@ int direct_remap_area_pages(struct mm_struct *mm,
     
     return 0;
 }
-
-
-#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
index f002a933344ba7576930f6f79874786eb6cbf6bb..82b5559bc9611cb9d52d5cf1ab660cb6a8933ea1 100644 (file)
@@ -1,11 +1,11 @@
 
 
-obj-y  += blkfront/
 obj-y  += console/
 obj-y  += evtchn/
-obj-y  += netfront/
 obj-y  += privcmd/
 
-obj-$(CONFIG_XEN_PHYSDEV_ACCESS)       += blkback/
-obj-$(CONFIG_XEN_PHYSDEV_ACCESS)       += netback/
+obj-$(CONFIG_XEN_BLKDEV_BACKEND)       += blkback/
+obj-$(CONFIG_XEN_NETDEV_BACKEND)       += netback/
+obj-$(CONFIG_XEN_BLKDEV_FRONTEND)      += blkfront/
+obj-$(CONFIG_XEN_NETDEV_FRONTEND)      += netfront/
 
index 166b70897c94575d82910afbbded0eed1f24d26b..683dd616da43620ed4098754a907825628512734 100644 (file)
 #define __GFP_NOWARN 0
 #endif
 
+/*
+ * If the backend driver is pipelining transmit requests then we can be very
+ * aggressive in avoiding new-packet notifications -- only need to send a
+ * notification if there are no outstanding unreceived responses.
+ * If the backend may be buffering our transmit buffers for any reason then we
+ * are rather more conservative.
+ */
+#ifdef CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
+#define TX_TEST_IDX resp_prod /* aggressive: any outstanding responses? */
+#else
+#define TX_TEST_IDX req_cons  /* conservative: not seen all our requests? */
+#endif
+
 static void network_tx_buf_gc(struct net_device *dev);
 static void network_alloc_rx_buffers(struct net_device *dev);
 
@@ -408,15 +421,9 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
     np->stats.tx_bytes += skb->len;
     np->stats.tx_packets++;
 
-    /* Only notify Xen if there are no outstanding responses. */
-    /*
-     * KAF (16/9/04): Checking outstanding responses is unsafe, as pending work
-     * may be dependent on packets not yet seen by the backend (e.g., he may
-     * have a partially-assembled fragmented IP packet). For now, the check is
-     * more conservative -- has the backend seen all previous requests?
-     */
+    /* Only notify Xen if we really have to. */
     mb();
-    if ( np->tx->req_cons/*resp_prod*/ == i )
+    if ( np->tx->TX_TEST_IDX == i )
         notify_via_evtchn(np->evtchn);
 
     return 0;
index 559df16eac2fbeee56d43cbe3045830b60ee3cd7..77d16e3e72fb18e55e6099ad09eb5ddefe8598c8 100644 (file)
@@ -53,7 +53,6 @@ extern void pte_free(struct page *pte);
 
 #define check_pgt_cache()      do { } while (0)
 
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 int direct_remap_area_pages(struct mm_struct *mm,
                             unsigned long address, 
                             unsigned long machine_addr,
@@ -64,6 +63,5 @@ int __direct_remap_area_pages(struct mm_struct *mm,
                              unsigned long address, 
                              unsigned long size, 
                              mmu_update_t *v);
-#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
 
 #endif /* _I386_PGALLOC_H */